<template>
	<view>
		<view v-for="(item,index) in list" :key="index" class="list" @click="select(item)">
				<view >
					<view style="margin-bottom: 10rpx;">
						<text style="font-size: 32rx;font-weight: bold;">{{item.realname}}</text>
						<text
							style="color:#999999;margin-left: 20rpx;margin-right: 20rpx;">{{item.phone}}</text>
					</view>
					<view class="" >
						{{item.province}}{{item.city}}{{item.county}}{{item.address}}
					</view>
				</view>
					
				
				<view class="icon" @click.stop="edit(item)">
					<image src="../../static/image/edit.png" mode="widthFix"></image>
				</view>
		</view>
		
		<view class="bottomFix" @click="sumbit">
			新增地址
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
list:[]
			}
		},
		methods: {
			select(item){
				let pages = getCurrentPages(); //获取所有页面栈实例列表
				let prevPage = pages[pages.length - 2]; //上一页页面实例
				if (prevPage.route == "pagesA/pages/order/confirmation") {
					prevPage.$vm.address_id = item.id; //修改上一页面的 couponNumber 参数值为 value
					uni.navigateBack({
						delta: 1
					})
				}
			},
			getList(){
				this.request(
					'user/address',
					'post'
				).then(res => {
					console.log(res.data)
					this.list=res.data;
					
				});
				
			},
			sumbit(){
				uni.navigateTo({
					url:'./addressMange'
				})
			}
			,
			edit(item){
				uni.navigateTo({
					url:'./addressMange?id='+item.id
				})
			}
			
			
			
		},
		onShow() {
			this.getList()
		}
	}
</script>

<style>
	page{
		background: #F1F1F1;
		min-height: 100vh;
	}
	.list{
		padding: 30rpx;
		background: #fff;
		display: flex;
		justify-content: space-between;
	}
	.bottomFix{
		width: 700rpx;
		border-radius: 100rpx;
		height: 80rpx;
		line-height: 80rpx;
		background: #FF976A;
		position: fixed;
		bottom: 50rpx;
		color: #fff;
		text-align: center;
		left: 30rpx;
	}
	.icon>image{
		width: 50rpx;
		height: 50rpx;
		margin-left: 20rpx;
	}
</style>